﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyMES.Domain.zmc;
using MyMES.Error;
using MyMES.Writer.API.Application.Commends.Productionorderss;

namespace MyMES.Writer.API.Controllers.Productionorderss
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProductionorderssController : ControllerBase
    {

        private readonly IMediator mediator;

        public ProductionorderssController(IMediator mediator)
        {
            this.mediator = mediator;
        }


        /// <summary>
        /// 生产工单---新
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        /// 
        [HttpPost]
        public async Task<APIResult<Productionorders>> Handle(CreateProductionordersCommends request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request, cancellationToken);
        }

        /// <summary>
        /// 添加并修改状态--报工记录
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPut]
        public async Task<APIResult<woekderProess>> CreateWorkderupdataZt(CreateWorkderupdataZtCommends request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request, cancellationToken);
        }
    }
}
